package com.zbf.反射;

import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author: LI-CI-GAO
 * 作者: licigao
 * 日期: 2021/8/20  15:31
 * 描述:
 */
public class TestFasnhe {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {

        Class<?> aClass = Class.forName("com.zbf.反射.YYYY");

        Class<YYYY> yyyyClass = YYYY.class;
        YYYY yyyy=new YYYY();
        yyyy.getClass();


        Constructor<?> constructor = aClass.getConstructor();

        Object o = constructor.newInstance();

        System.out.println(o instanceof YYYY);

        Constructor<?>[] declaredConstructors = aClass.getDeclaredConstructors();


        Method setName = aClass.getMethod("setName");

        setName.invoke(o,"5555555");

        //Annotation annotation = setName.getAnnotation();



    }
}
